import { APP_INITIALIZER } from '@angular/core';

import { LockScreenService, LOCK_SCREEN_STORAGE_KEY } from './lock-screen.service';
import { WindowService } from './window.service';
export const LockScreenAppInitializer = {
  provide: APP_INITIALIZER,
  useFactory: (lockScreenSrc: LockScreenService, windowSrc: WindowService) => () => {
    // 获取存储信息
    var hasCash = windowSrc.getSessionStorage(LOCK_SCREEN_STORAGE_KEY);
    if (hasCash) {
      lockScreenSrc.publish(JSON.parse(hasCash));
    }
  },
  deps: [LockScreenService, WindowService],
  multi: true
};
